home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / prcm243u.zip / PCP-MENU.CMD < prev    next >
OS/2 REXX Batch file  |  1986-09-21  |  14KB  |  443 lines

  1. ;*********************************************************************
  2. ;
  3. ; ProComm 2.4 Command file to dial PC Pursuit numbers.  Demonstrates
  4. ; menu building, branching on user input, etc.  Please note that only
  5. ; three cities are implemented in this demo.
  6. ;
  7. ; String variables are used extensively here.  Their uses are:
  8. ;
  9. ; S0 - holds user input for SWITCHing
  10. ; S1 - holds PCP city name
  11. ; S2 - holds PCP city area code
  12. ; S3 - holds final destination name
  13. ; S4 - holds final destination phone number
  14. ; S5 - holds user input for SWITCHing
  15. ; S6 - you must set to modem dial command and local TELENET number
  16. ; S7 - you must set to apporpriate baud rate (3 or 12)
  17. ; S8 - you must set to your PCP user id
  18. ; S9 - you must set to your PCP password
  19. ;
  20. ;*********************************************************************
  21.  
  22.  
  23.  
  24. ; Customization area - you need to change these for your setup
  25.  
  26.  
  27.    ASSIGN S9 "12"               ; Enter the baudrate to use here, 3 or 12
  28.    ASSIGN S8 "xxxxxxx"          ; Enter the id to be used here
  29.    ASSIGN S7 "xxxxxxxx"         ; Enter the password to be used here
  30.    ASSIGN S6 "ATDTxxx-xxxx!"    ; Enter dial cmd and local telenet # here
  31.  
  32.  
  33.    SET CR_IN CR                 ; make sure no extra LF's in menus
  34.    CLEAR                        ; clear the screen
  35.  
  36.    LOCATE 1,0                   ; position the cursor
  37.  
  38. ; Build the first menu
  39.  
  40.    MESSAGE "                       ┌┤ PC PURSUIT AVAILABLE CITIES ├┐"
  41.    MESSAGE "                       │                               │"
  42.    MESSAGE "                       │       1- ATLANTA              │"
  43.    MESSAGE "                       │       2- BOSTON               │"
  44.    MESSAGE "                       │       3- DALLAS               │"
  45.    MESSAGE "                       │       4- DENVER               │"
  46.    MESSAGE "                       │       5- DETROIT              │"
  47.    MESSAGE "                       │       6- HOUSTON              │"
  48.    MESSAGE "                       │       7- LOS ANGELES          │"
  49.    MESSAGE "                       │       8- NEWARK               │"
  50.    MESSAGE "                       │       9- NEW YORK             │"
  51.    MESSAGE "                       │      10- PHILADELPHIA         │"
  52.    MESSAGE "                       │      11- SAN FRANCISCO        │"
  53.    MESSAGE "                       │      12- SEATTLE              │"
  54.    MESSAGE "                       │      13- WASHINGTON, DC       │"
  55.    MESSAGE "                       ├───────────────────────────────┤"
  56.    MESSAGE "                       │ ENTER THE # OF THE CITY OF    │"
  57.    MESSAGE "                       │ YOUR CHOICE:                  │"
  58.    MESSAGE "                       └───────────────────────────────┘"
  59.  
  60. L1:                             ; label for use by default case
  61.  
  62.    LOCATE 18,38                 ; position cursor
  63.    MESSAGE "  "                 ; clear prompt area
  64.    LOCATE 18,38                 ; reposition cursor
  65.    GET S0 2                     ; get users choice
  66.  
  67.    SWITCH S0                    ; switch on choice
  68.  
  69.       CASE "1"                  ; chose ATLANTA
  70.          ASSIGN S1 "ATLANTA"    ; save the city name
  71.          ASSIGN S2 "404"        ; save the area code
  72.          GOSUB ATLANTA          ; go get number to dial
  73.       ENDCASE
  74.  
  75.       CASE "5"                  ; chose DETROIT
  76.          ASSIGN S1 "DETROIT"    ; save the city name
  77.          ASSIGN S2 "313"        ; save the area code
  78.          GOSUB DETROIT          ; go get number to dial
  79.       ENDCASE
  80.  
  81.       CASE "13"                       ; chose WASHINGTON DC
  82.          ASSIGN S1 "WASHINGTON, DC"   ; save the city name
  83.          ASSIGN S2 "202"              ; save the area code
  84.          GOSUB WASHINGTON_DC          ; go get number to dial
  85.       ENDCASE
  86.  
  87.       DEFAULT                   ; all other cases
  88.          LOCATE 22,24
  89.          MESSAGE "^G"           ; error noise
  90.          LOCATE 22,24
  91.          MESSAGE "Not yet implemented in this demo"
  92.          LOCATE 22,24
  93.          PAUSE 2
  94.          MESSAGE "                                "
  95.          GOTO L1
  96.       ENDCASE
  97.    ENDSWITCH
  98.  
  99. ;
  100. ; Ok, call the local TELENET number first.  This is an example of
  101. ; redialing without using the DIAL or Alt-R commands
  102. ;
  103.  
  104.    CLEAR                        ; ready to call TELENET
  105.    SET PARITY EVEN              ; set parms for TELENET
  106.    SET DATABITS 7
  107.    MESSAGE "DIALING PCP"        ; let em know whats happening
  108.    LOCATE 0,12
  109.    MESSAGE S1                   ; include city in message
  110.  
  111. L2:                             ; label for busy TELENET
  112.  
  113.    TRANSMIT S6                  ; call local Telenet
  114.    WAITFOR "CONNECT" 15         ; give it 15 seconds to answer
  115.  
  116.    IF NOT WAITFOR               ; it didn't connect, assume busy
  117.       CLEAR                     ; example of redialing without Alt-R
  118.       HANGUP
  119.       MESSAGE "PCP TELENET IS BUSY.  REDIALING..."
  120.       GOTO L2
  121.    ENDIF
  122.  
  123. ;
  124. ; Ok, made it to local telenet number, now call the remote PCP city
  125. ; Notice that we redial at this point as well
  126. ;
  127.  
  128.    PAUSE 2
  129.    TRANSMIT "^m^m"              ; Get Telenet's attention
  130.    WAITFOR "="                  ; Wait for 'TERMINAL=' prompt
  131.    TRANSMIT "D1!"               ; Enter terminal type
  132.    WAITFOR "@"                  ; Wait for Telenet prompt
  133.  
  134. L3:                             ; label for busy remote PCP city
  135.    TRANSMIT "C DIAL"
  136.    TRANSMIT S2                  ; area code
  137.    TRANSMIT "/"
  138.    TRANSMIT S9                  ; BAUD RATE
  139.    TRANSMIT ","
  140.    TRANSMIT S8                  ; ID
  141.    TRANSMIT "!"                 ; cr
  142.  
  143.    WAITFOR "="                  ; Wait for 'PASSWORD=' prompt
  144.  
  145.    TRANSMIT S7                  ; Enter password
  146.    TRANSMIT "!"                 ; cr
  147.  
  148.    RGET S5                      ; Get the CR echoed from our TRANSMIT
  149.    RGET S5                      ; Get the CR that precedes PCP messages
  150.    RGET S5                      ; Get the actual message
  151.    PAUSE 1                      ; Display it briefly
  152.  
  153.    FIND S5 "CONNECT"            ; Look for connection
  154.  
  155.    IF NOT FOUND                 ; No connection
  156.       CLEAR
  157.       MESSAGE "THE REMOTE PCP IS BUSY.  REDIALING..." S1
  158.       LOCATE 1 0
  159.       GOTO L3
  160.    ENDIF
  161.  
  162. ;
  163. ; Ok, made it to the remote PCP city.  Display appropriate message
  164. ; then call the actual destination, again using a redial
  165. ;
  166.  
  167.    CLEAR
  168.    MESSAGE "CONNECTED TO PCP"
  169.    LOCATE 0,17
  170.    MESSAGE S1
  171.    LOCATE 1,0
  172.    MESSAGE "DIALING"
  173.    LOCATE 1,8
  174.    MESSAGE S3
  175.  
  176. L4:                             ; label for busy number
  177.  
  178.    LOCATE 2 0
  179.    TRANSMIT "ATZ!"              ; Wake up remote modem
  180.    WAITFOR "OK"                 ; Wait for 'OK' prompt
  181.  
  182.    TRANSMIT "ATDT"
  183.    TRANSMIT S4                  ; THE NUMBER
  184.    TRANSMIT "!"                 ; CR
  185.  
  186.    RGET S0                      ; Get CR echoed from our TRANSMIT
  187.    RGET S0 80 40                ; Get CR that precedes PCP messages
  188.    RGET S0                      ; Get the real message
  189.    PAUSE 2
  190.  
  191.    FIND S0 "BUSY"               ; was it busy?
  192.    IF FOUND
  193.       CLEAR
  194.       MESSAGE "BUSY.  REDIALING..." S3
  195.       GOTO L4
  196.    ENDIF
  197.  
  198.    FIND S0 "CONNECT"            ; did it connect?
  199.    IF FOUND
  200.       SET PARITY NONE           ; Switch to N/8/1 for BBS work
  201.       SET DATABITS 8
  202.       CLEAR
  203.       MESSAGE "CONNECTED TO"
  204.       LOCATE 0,13
  205.       MESSAGE S3
  206.       LOCATE 1,0
  207.       MESSAGE "LOGON PRECEEDING"
  208.    ELSE                         ; not busy or connect, assume error
  209.       CLEAR
  210.       MESSAGE "NO CONNECT OR BUSY. REDIALING"
  211.       GOTO L4
  212.    ENDIF
  213.  
  214.    ALARM 2                      ; sound alarm for 2 seconds
  215.    EXIT                         ; we made it!
  216.  
  217.  
  218.  
  219. ;********************************************************************
  220. ;
  221. ; SUBROUTINES START HERE
  222. ;
  223. ; note that you could put these at the beginning of the file, and
  224. ; initially branch around them.  As each GOSUB and GOTO starts looking
  225. ; at the top of the file, it would speed up some parts of the process,
  226. ; while slowing down others.  Maybe next time we'll build a symbol table
  227. ; and eliminate this inefficiency.
  228. ;
  229. ;**************************************